<template>
  <div class="person">
    <h1>你好啊</h1>
    <h1>姓名：{{ name }}</h1>
    <h1>年龄：{{ age }}</h1>
    <button @click="showTel">查看联系方式</button>
    <button @click="changeName">改名</button>
    <button @click="changeAge">年龄增加</button>
  </div>
</template>

<script lang="ts">
export default {
  name: 'Person',
  // vue2 的语法
  data() {
    return {
      name: '张山',
      age: 20,
      tel: '13512345678',
    }
  },
  methods: {
    changeAge() {
      this.age += 1
    },
    changeName() {
      this.name = 'zhang -san'
    },
    showTel() {
      alert(this.tel)
    },
  },
  // vue2 的语法
}
</script>

<style scoped>
.person {
  background-color: skyblue;
  box-shadow: 0 0 10px;
  border-radius: 10px;
  padding: 10px;
}
button {
  margin: 0 5px;
}
</style>
